package com.openness.example.hbase;

import java.io.IOException;

import org.apache.hadoop.hbase.util.Bytes;

import com.openness.crawler.crawler.CrawlConfig;
import com.openness.crawler.hbase.HBaseTablePool;
import com.openness.crawler.hbase.HBaseUtil;
import com.openness.crawler.hbase.Row;

/**
 * @author Rain
 * @version 2013-5-30 下午4:34:59
 */

public class PutMain {

	public static void main(String[] args) throws IOException {
		Row row1 = new Row(Bytes.toBytes("1"));
		row1.add("number", Bytes.toBytes("0606054120"));
		row1.add("name", Bytes.toBytes("myr"));

		Row row2 = new Row(Bytes.toBytes("2"));
		row2.add("number", Bytes.toBytes("gs11211c1"));
		row2.add("name", Bytes.toBytes("rain"));
		
		CrawlConfig config = new CrawlConfig();

		config.setHbaseMaster("leaderman.rain.centos");

		config.setHbaseZooKeeperQuorum("leaderman.rain.centos");

		config.setHbaseZooKeeperPropertyClientPort("2181");

		config.setHbaseTablePoolSize(5);
		
		HBaseTablePool.initialize(config);

		HBaseUtil.putRows("student", new Row[] { row1, row2 });
		
		HBaseTablePool.shutdown();
	}

}
